/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xos_http.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __MSG_NOTIFY_MSG_NOTIFY_UDP_H__
#define __MSG_NOTIFY_MSG_NOTIFY_UDP_H__

namespace xos_http
{
    class notify_udp
    {
    public:
        notify_udp();
        ~notify_udp();

    public:
        int post_init_server( xos_box::i_msg *& pMsg, connection * pConnect );
        int post_send( xos_box::i_msg *& pMsg, connection * pConnect, const char * lpszIp, int nPort, const char * lpszData, bool bCloseAfterSend, bool bQuitAfterSend );
        int post_send( xos_box::i_msg *& pMsg, connection * pConnect, const char * lpszIp, int nPort, const char * lpszData, int nLen, bool bCloseAfterSend, bool bQuitAfterSend );
        int post_send( xos_box::i_msg *& pMsg, connection * pConnect, const char * lpszIp, int nPort, xos_box::i_buf * pBuf, bool bCloseAfterSend, bool bQuitAfterSend );
        int post_shutdown( xos_box::i_msg *& pMsg, connection * pConnect, int how );
        int post_close( xos_box::i_msg *& pMsg, connection * pConnect );

    protected:
        int on_init_server( xos_box::i_msg *& pMsg );
        int on_send( xos_box::i_msg*& pMsg );
        int on_recv( xos_box::i_msg*& pMsg );
        int on_shutdown( xos_box::i_msg*& pMsg );
        int on_close( xos_box::i_msg*& pMsg );

    public:
        int proc( xos_box::i_msg *& pMsg );

    };

} // xos_http

#endif // __MSG_NOTIFY_MSG_NOTIFY_UDP_H__
